//
//  RestaurantTableViewCell.m
//  ClassifyShop
//
//  Created by yuyao on 15/3/7.
//  Copyright (c) 2015年 yuyao. All rights reserved.
//

#import "RestaurantTableViewCell.h"
#import "GUIDefine.h"
@implementation RestaurantTableViewCell
@synthesize alphaGrayBottomView,bigImageView,titleLabel,typeBackImageView,
typeLabel,shiyongLabel,shoucangImage,shoucangLabel,avCostLabel,starRateView;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self setBackgroundColor:[UIColor whiteColor]];
        UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0,kAppScreenWidth,(kAppScreenWidth-100)/2+1)];
        [backView.layer setBorderColor:[UIColor lightGrayColor].CGColor];
        [backView.layer setBorderWidth:1];
        [self.contentView addSubview:backView];
        
        bigImageView = [[UIImageView alloc] initWithFrame:CGRectMake(1, 1, kAppScreenWidth-100,  (kAppScreenWidth-100)/2)];
        [bigImageView setBackgroundColor:[UIColor whiteColor]];
        [backView addSubview:bigImageView];
        
        
        alphaGrayBottomView = [[UIView alloc] initWithFrame:CGRectMake(0,bigImageView.frame.size.height-25 , kAppScreenWidth-100, 25)];
        [alphaGrayBottomView setBackgroundColor:[[UIColor grayColor] colorWithAlphaComponent:0.5]];
        [backView addSubview:alphaGrayBottomView];
        
        UIFont *fnt = [UIFont fontWithName:@"Arial" size:12.0f];
        titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0,70, 25)];
        [titleLabel setFont:fnt];
        [titleLabel setTextColor:[UIColor whiteColor]];


        [alphaGrayBottomView addSubview:titleLabel];
        
        
        
        starRateView = [[CWStarRateView alloc] initWithFrame:CGRectMake(titleLabel.frame.size.width, 5, 60, 15) numberOfStars:5];
        starRateView.allowIncompleteStar = YES;
        starRateView.hasAnimation = YES;
        [alphaGrayBottomView addSubview:self.starRateView];
        
        
        shoucangImage  = [[UIImageView alloc] initWithFrame:CGRectMake(alphaGrayBottomView.frame.size.width-50, 4, 17, 17)];
        [alphaGrayBottomView addSubview:shoucangImage];
        
        shoucangLabel = [[UILabel alloc] initWithFrame:CGRectMake(alphaGrayBottomView.frame.size.width-30, 0, 30, 25)];
        [shoucangLabel setTextColor:[UIColor whiteColor]];
        [shoucangLabel setFont:[UIFont fontWithName:@"Arial" size:12]];
        [alphaGrayBottomView addSubview:shoucangLabel];
        
        
        UIImageView *backImage1 = [[UIImageView alloc] initWithFrame:CGRectMake(kAppScreenWidth-100, 25, 100, 25)];
        [backImage1 setImage:[appDelegate scaleToSize:[UIImage imageNamed:@"middle.png"] size:CGSizeMake(100, 25)]];
        [backView addSubview:backImage1];
        typeLabel = [[UILabel alloc] initWithFrame:CGRectMake(kAppScreenWidth-100, 25, 100, 25)];
        [typeLabel setTextColor:[UIColor whiteColor]];
        [typeLabel setTextAlignment:NSTextAlignmentCenter];
        [typeLabel setFont:[UIFont fontWithName:@"Arial" size:10]];
        [backView addSubview:typeLabel];
        
        
        
        avCostLabel = [[UILabel alloc] initWithFrame:CGRectMake(kAppScreenWidth-90, 70, 80, 10)];
        [avCostLabel setTextAlignment:NSTextAlignmentLeft];
        [avCostLabel setFont:[UIFont fontWithName:@"Arial" size:10]];

        [backView addSubview:avCostLabel];
        
        shiyongLabel = [[UILabel alloc] initWithFrame:CGRectMake(kAppScreenWidth-90, 80, 80, 25)];
        [shiyongLabel setTextAlignment:NSTextAlignmentLeft];
        [shiyongLabel setLineBreakMode:NSLineBreakByCharWrapping];
        [shiyongLabel setNumberOfLines:0];
        [shiyongLabel setFont:[UIFont fontWithName:@"Arial" size:10]];

        [backView addSubview:shiyongLabel];
        
        
        
        
        
    }
    
    return self;
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
